using Nancy;

namespace CodeflowsHost.Dashboard.Modules
{
    public class AssetsModule : NancyModule
    {
        public AssetsModule() : base("/Assets")
        {
            Get["/CSS/{file}"] = parameters =>
            {
                var content = GetType().Assembly
                    .GetManifestResourceStream("CodeflowsHost.Dashboard.Assets.CSS." + (string)parameters.file);

                return Response.FromStream(content, "text/css");
            };

            Get["/JS/{file}"] = parameters =>
            {
                var content = GetType().Assembly
                    .GetManifestResourceStream("CodeflowsHost.Dashboard.Assets.JS." + (string)parameters.file);

                return Response.FromStream(content, "text/javascript");
            };
        }
    }
}